package com.zxd.dao;

import com.zxd.entity.Module;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * ModuleDao
 * Created by 奕恒 on 2017/2/20 21:47.
 */
public interface ModuleDao extends JpaRepository<Module, Integer>, JpaSpecificationExecutor<Module> {

    @Query("select a from Module a where a.parentId = ?1")
    List<Module> findListByParentId(Integer parentId);

    @Query("select a from Module a where a.name = ?1")
    Module findOneByName(String name);
}